package com.yl.test;

import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.java.tuple.Tuple2;

import java.util.Map;

public class WordMapFunc implements MapFunction<Tuple2<String, Long>, Tuple2<String, Long>>{

    private Map<String, Integer> wordMap;

    public WordMapFunc(Map<String, Integer> wordMap) {
        this.wordMap = wordMap;
    }

    @Override
    public Tuple2<String, Long> map(Tuple2<String, Long> tp2) throws Exception {
        wordMap.put(tp2.f0, tp2.f1.intValue());
        return tp2;
    }
}
